package com.thoughtworks.opensource.yui.dd.client.triads.constrainedgrid;
/*
   Copyright 2006 C. K. Sidu Ponnappa

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.thoughtworks.opensource.yui.dd.client.domain.MyNumberView;
import com.thoughtworks.opensource.yui.dd.client.helpers.Factory;
import com.thoughtworks.opensource.yui.dd.client.windowresources.DisplayAreaViewBase;
import com.thoughtworks.opensource.yui.dd.client.windowresources.DropArea;
import com.thoughtworks.opensource.yui.dd.client.windowresources.HostedFlowPanel;

/**
 * Created by IntelliJ IDEA.
 * Author: C. K. Sidu Ponnappa
 * Date: Nov 22, 2006
 * Time: 1:33:29 AM
 * ThoughtWorks India Pvt. Ltd.
 */
public class ConstrainedGridView extends HostedFlowPanel implements DropArea {
    private ConstrainedGridController controller;

    public ConstrainedGridView(DisplayAreaViewBase hostView, ConstrainedGridController controller) {
        super(hostView);
        this.controller = controller;
        for (int i = 0; i < 10; i++) {
            this.add(Factory.createLabel("cell_" + i, "", "gridCell"));
        }
    }

    public void dragDropNotification(Widget droppedWidget) {
        //TODO: implement dispose() for Widgets
        GWT.log("Drop area ConstrainedGridView recieved drop notification, Widget hash:" + droppedWidget.hashCode(), null);
        controller.recievedDrop(droppedWidget);
    }

    public void dragEnterNotification(Object hoveringDomainObject) {
        MyNumberView myNumber = (MyNumberView) hoveringDomainObject;
        GWT.log("Drop area ConstrainedGridView recieved hover notification:" + myNumber.getNumber() + "", null);
    }
}